<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "https://raw.githubusercontent.com/rbatis/rbatis/master/rbatis-codegen/mybatis-3-mapper.dtd">
<mapper>

    <select id="select_user_page">
        `select t.id, t.username, t.password, t.user_type, t.permission_biz from api_user as t`
        <where>
            ` 1 = 1 `
            <if test="username != '' && username != null">
                ` and username like concat('%', #{username}, '%') `
            </if>
            <if test="user_type != null" >
                ` and t.`user_type` = #{user_type} `
            </if>
        </where>
        `order by t.username asc limit #{page_size} offset #{page_num}`
    </select>

    <select id="select_user_page_count">
        `select count(1) from api_user as t`
        <where>
            ` 1 = 1 `
            <if test="username != '' && username != null">
                ` and username like concat('%', #{username}, '%') `
            </if>
            <if test="user_type != null" >
                ` and t.`user_type` = #{user_type} `
            </if>
        </where>
    </select>
</mapper>